package com.lazycat.backend.controller.cart;

import com.lazycat.backend.service.cart.AddToCartService;
import com.lazycat.backend.service.cart.DelFromCartService;
import com.lazycat.backend.service.shop.DeleteGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class DelFromCartController {
    @Autowired
    private DelFromCartService delFromCartService;

    @PostMapping("cart/delete/")
    public Map<String, Object> insert(@RequestBody Map<String, String> map) {
        Integer userId = Integer.parseInt(map.get("userId"));
        Integer goodId = Integer.parseInt(map.get("goodId"));
        return delFromCartService.del(goodId, userId);
    }

}
